home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / share / ewl / examples / ewl_filedialog_test.c < prev    next >
C/C++ Source or Header  |  2006-01-09  |  1KB  |  46 lines

  1. #include "ewl_test.h"
  2.  
  3. static void __create_fd_window_response (Ewl_Widget *w, void *ev, void *data);
  4.  
  5. static void
  6. __destroy_filedialog_test_window(Ewl_Widget * w, void *ev_data __UNUSED__,
  7.         void *user_data __UNUSED__)
  8. {
  9.     ewl_widget_destroy(w);
  10. }
  11.  
  12. void
  13. __create_filedialog_test_window(Ewl_Widget *w, void *ev_data __UNUSED__,
  14.         void *user_data __UNUSED__)
  15. {
  16.     Ewl_Widget *fd = NULL;
  17.  
  18.     fd = ewl_filedialog_new();
  19.     if (w)
  20.         ewl_callback_append(fd, EWL_CALLBACK_DELETE_WINDOW,
  21.                 __destroy_filedialog_test_window, NULL);
  22.     else
  23.         ewl_callback_append(fd, EWL_CALLBACK_DELETE_WINDOW,
  24.                 __close_main_window, NULL);
  25.  
  26.     ewl_filedialog_type_set(EWL_FILEDIALOG(fd), EWL_FILEDIALOG_TYPE_OPEN);
  27.     ewl_callback_append(fd, EWL_CALLBACK_VALUE_CHANGED, 
  28.                 __create_fd_window_response, NULL);
  29.     ewl_widget_show(fd);
  30. }
  31.  
  32. static void
  33. __create_fd_window_response (Ewl_Widget *w, void *ev, void *data __UNUSED__)
  34. {
  35.     Ewl_Dialog_Event *e;
  36.  
  37.     e = ev;
  38.     if (e->response == EWL_STOCK_OPEN)
  39.         printf("file open from test program: %s\n", 
  40.                 ewl_filedialog_file_get(EWL_FILEDIALOG (w)));
  41.  
  42.     else if (e->response == EWL_STOCK_CANCEL)
  43.         printf("Test program says bugger off.\n");
  44. }
  45.  
  46.